package cn.com.tianpeidong.restaurantadmin.project.admin.dishes.constant;

/**
 * @author tianpeidong
 * 菜品类型
 */
public enum PackageType {

    /**
     * 单品
     */
    SINGLE(0, "单品"),

    /**
     * 套餐
     */
    PACKAGE(1, "套餐"),

    /**
     * undefined
     */
    NIL(-1, "undefined")
    ;

    private final Integer code;
    private final String description;

    PackageType(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    public Integer getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static PackageType matchState(int stateCode) {
        for (PackageType state : PackageType.values()) {
            if (state.getCode() == stateCode) {
                return state;
            }
        }
        return PackageType.NIL;
    }
}
